﻿@model DAEProde.Domain.MatchDate

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Resultados @Model.Name</h2>

@using (Html.BeginForm("LoadResult", "MatchDateManager", FormMethod.Post, new { style = "display:inline" }))
{
                
    @Html.AntiForgeryToken()
    @Html.Hidden("tId", Model.Tournament.Id)
    @Html.Hidden("mId", Model.Id)

<fieldset>
    <legend>Cargar Resultados</legend>

    <table>
        <tr>
            <th>
                Nombre
            </th>
            <th>
                Equipo Local
            </th>
            <th>
                Equipo Visitante
            </th>
            <th>
                Resultado
            </th>
        </tr>

        @foreach (var item in Model.Matches)
        {
            <tr>
                <td>
                    @item.Name
                </td>
                <td>
                    @item.LocalTeam.Name
                </td>
                <td>
                    @item.OutTeam.Name
                </td>
                <td>                
                        <select name="Result">
                    @foreach (var it in new List<string> { "Sin Cargar", "Local", "Empate", "Visitante" })
                    {
                        <option value="@it" @(it.Equals(item.Result) ? "selected=\"selected\"" : "")>@it</option>
                    }
                </select>
                </td>
            </tr>
        }
    </table>
        
    <div><input type="submit" value="Guardar" /></div>

</fieldset>
}
<p>
    @Html.ActionLink("Volver", "Index", "MatchDateManager", new { id = Model.Tournament.Id }, null)
</p>